package com.lys.emsystem.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lys.emsystem.mapper.CollegeMapper;
import com.lys.emsystem.entity.College;
import com.lys.emsystem.service.CollegeService;
import com.lys.emsystem.vo.CollegeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CollegeServiceImpl implements CollegeService {
    @Autowired
    private CollegeMapper collegeMapper;

    @Override
    public IPage<College> search(Page<College> page, CollegeVo collegeVo) {
        return collegeMapper.search(page, collegeVo);
    }

    @Override
    public int addCollege(College college) {
        return collegeMapper.insert(college);
    }

    @Override
    public int updateCollege(College college) {
        return collegeMapper.updateById(college);
    }

    @Override
    public int deleteCollege(int collegeId) {
        return collegeMapper.deleteById(collegeId);
    }

    @Override
    public int deleteColleges(int[] ids) {
        return collegeMapper.delList(ids);
    }

    @Override
    public List<College> searchCollegesBySchoolIds(int id) {
        return collegeMapper.searchCollegesBySchoolIds(id);
    }

}
